package com.xianniu.ltc.enums;

import lombok.Getter;

/**
 * @author wangruijie
 * @version 1.0
 * @description: < 线索状态 >
 * @date 2021/5/27 19:32
 */
@Getter
public enum LeadStatusEnum {
    YGB("已关闭","019-0179888ae6be00af"),
    YLX("已联系","019-0179888afad600b0"),
    DCL("待处理","019-0179888b0d4c00b1");

    private String key;
    private String value;

    LeadStatusEnum(String key, String value){
        this.key=key;
        this.value=value;
    }
    /**
     * 自己定义一个静态方法,通过key返回枚举常量对象
     * @param key
     * @return
     */
    public static LeadStatusEnum getByKey(String key){

        for (LeadStatusEnum color: values()) {
            if(color.getKey().equals(key)){
                return  color;
            }
        }
        return null;
    }

    /**
     * 自己定义一个静态方法,通过value返回枚举常量对象
     * @param value
     * @return
     */
    public static LeadStatusEnum getByValue(String value){

        for (LeadStatusEnum color: values()) {
            if(color.getValue().equals(value)){
                return color;
            }
        }
        return null;
    }
}
